package kr.co.doriclassic.chpater22test;

import java.util.Collections;

public class Array {
	public static <T> T getLast(T[] a){
		
		return a[a.length - 1];
	}
	
	public static <T extends Comparable> T getMax(T[] a){
		if(a==null||a.length==0){
			return null;
		}
		T largest = a[0];
		for (int i = 0; i < a.length; i++) {
			if(largest.compareTo(a[i])>0){
				largest = a[i];
				return largest;
			}
		}
		return largest;
	}
	
	public static void main(String[] args) {
		String[] languate = {"C++","JAVA", "C#"};
		String last = Array.<String>getLast(languate);
		System.out.println(last);
		
	}
	
	
}
